

<!--********************* Part1:Jsp Head *********************-->

<%@ page contentType="text/html;charset=UTF-8"%>  
<%@ include file="/framework/head.jsp"%>

<!--********************* Part2:Java Code *********************-->
<%
    BusMaterialAccountKilSearchEvent event = (BusMaterialAccountKilSearchEvent)context.getSessionValue("BusMaterialAccountKilSearchEvent");
    ObjectList list = BusMaterialAccountKil.fetch().search(con,event);
%>

<!--********************* Part3:JavaScript Code ***************-->
<!--start 客户端脚本区域-->
<%@page import="java.util.Vector"%>
<%@page import="system.base.BusMaterialAccountKil" %>
<%@page import="system.base.BusMaterialAccount"%>
<%@page import="system.base.Warehouse"%>
<script language=javascript>

var list_code = "listBusMaterialAccountKil";

function doSearch()
{

    //SetValue("s_Id",GetValue("i_Id")); //序号

    SetValue("s_WarehouseCode",GetValue("i_WarehouseCode")); //仓库编码

    //SetValue("s_BusTypeCode",GetValue("i_BusTypeCode")); //车型编码

    //SetValue("s_BusCategoryCode",GetValue("i_BusCategoryCode")); //车类编码

    //SetValue("s_BusTag",GetValue("i_BusTag")); //车牌号

    SetValue("s_RepairenTime",GetValue("i_year")+GetValue("i_month")); //维修时间

    //SetValue("s_KilRepairedMoney",GetValue("i_KilRepairedMoney")); //千公里维修费用
    

    //SetValue("s_OrderField",GetValue("i_OrderField")); //排序
    //SetValue("s_OrderDesc",getCheckBoxValues("i_OrderDesc")); //升降序
    doCommonSearch();
}

function bizViewBusMaterialAccountKil(id)
{
    viewWin("<%=Config.getSrv()%>?action_code=viewBusMaterialAccountKil&Id="+id);
}

function doDelete()
{
    if(!hasChooseRadio("ids"))
    {
        bizMessage("删除","车辆维修材料费用");
        return false;
    }
    if(!bizConfirm("删除","车辆维修材料费用")) return false;
    SetAction("deleteBusMaterialAccountKil");
    frm.submit();
}

function doToAdd()
{
    SetAction("toAddBusMaterialAccountKil");
    frm.submit();
}

function doToUpdate()
{
    if(!checkOne("ids")) 
    {
        bizMessage("修改","车辆维修材料费用");
        return false;
    }
    SetValue("Id",getCheckBoxValue("ids"));
    SetAction("toUpdateBusMaterialAccountKil");
    frm.submit();
}
function doToCopy()
{
    if(!checkOne("ids")) 
    {
        bizMessage("复制","车辆维修材料费用");
        return false;
    }
    SetValue("Id",getCheckBoxValue("ids"));
    SetAction("toCopyBusMaterialAccountKil");
    frm.submit();
}

key_InitDefault();
key_RegSubmitHandler(doSearch);
</script>


<%=uiBody%>>

<%@ include file="/framework/menu.jsp"%>

<!--********************* Part4:Form  ***************-->
<form id=frm action="<%=Config.getSrv()%>" method="post">
<input type=hidden name="action_code" value="">
<input type=hidden name="Id" value="">
<input type=hidden name=sortOrder value="1">

<!--查询条件保留区域-->

<input type=hidden name="s_WarehouseCode" value="<%=event.getWarehouseCode()%>"> <!--仓库编码-->
<input type=hidden name="s_RepairenTime" value="<%=event.getRepairenTime()%>"> <!--维修时间-->



<%@ include file="/framework/list_head.jsp"%>

<br>
<!--********************* Part5:Search Area ***************-->
<%=uiSearchStart%>>
<%
    int key_tab = 1 ;
%>
<%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            仓库选择：
        </td>
        <%=uiSearchInputTDHead%>>
            <%=SelectManager.viewWarehouseSelect(con,loginInfo.getLoginWarehouseCode(),"i_WarehouseCode",event.getWarehouseCode(),false,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
        </td>       
    </tr>

    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            选择结算月份：
        </td>
        <%=uiSearchInputTDHead%>>
            <%=SelectManager.viewYearSelect(con,"i_Year","2008",false,"","-请选择-","","")%>  <%=SelectManager.viewMonthSelect(con,"i_Month","01",false,"","-请选择-","","")%>
            <input type="button" value="查询" class="buttons" onclick="doSearch();return false;">&nbsp;
        </td>       
    </tr>  

<%=uiSearchEnd%>

<!--列表标题--><%
    boolean isfirst = ((Boolean)(context.getSessionValue("isfirst"))).booleanValue();
     String menu = (String)context.getSessionValue("choice");
    Vector vec = (Vector)context.getValue(menu);
    String[] warehouseCodes = null;
    if(!isfirst && vec != null && vec.size() > 0){
        warehouseCodes = BusMaterialAccountKil.getStr(vec,1);
        warehouseCodes = BusMaterialAccountKil.setStrArray(warehouseCodes);
    }
%>
<%String repairTime = event.getRepairenTime(); %>
<%String year = repairTime.substring(0,4); %>
<%String month = repairTime.substring(4,6); %>
<% 
if(isfirst || repairTime == null || repairTime.equals("000000") || repairTime.equals("")){%>
    <%=UIManager.addListHeadTitle("单一公司车型千公里对比")%>    
<%}else{%>
    <%=UIManager.addListHeadTitle("公司"+year+"年"+month+"月分车型千公里材料费用对比")%>
<%}%>


<!--********************* Part6:List Area ***************-->

<%=uiListStart%>>
<%int index = 1 ;%>  
    <%=uiListHeadTR%>>
        <%=UIManager.addListHead("车型",index++)%>
        <%=UIManager.addListHead("类别",index++)%>
        <%=UIManager.addListHead("上月费用",index++,"num")%>
        <%=UIManager.addListHead("本月费用",index++,"num")%>
        <%=UIManager.addListHead("本年累计费用",index++,"num")%>
        <%=UIManager.addListHead("本年月平均费用",index++,"num")%>
        <%=UIManager.addListHead("去年月平均费用",index++,"num")%>
        <%=UIManager.addListHead("本月份同比",index++,"num")%>
        <%=UIManager.addListHead("本月份环比",index++,"num")%>
    <%=uiListHeadTREnd%>>
    <%=uiListDataTR[0]%> align=center>  
        
<%if(!isfirst ){ %>
<%if(vec != null && vec.size() > 0) {%>
        <% String[] busTypeCode = BusMaterialAccountKil.setStrArray(BusMaterialAccountKil.getStr(vec,2));//取出本数组中的重复项 %>
        <% String[] BUS_CATEGORY_CODE = BusMaterialAccountKil.setStrArray(BusMaterialAccountKil.getStr(vec,3));//取出本数组中的重复项 %>
        <%
        Vector moneyVec = new Vector();
        for(int i = 0;i < busTypeCode.length;i++){//
            %>
            <% for(int j = 0;j < BUS_CATEGORY_CODE.length;j++){%>
               <%String[] moneys = BusMaterialAccountKil.getMoneyValues1(year,month,busTypeCode[i],BUS_CATEGORY_CODE[j],warehouseCodes[0],con);//获取本车辆金额信息%>
                <%=uiListDataTR[0]%> align=center>  
                    <%=uiListDataTD%>><%=busTypeCode[i] %></td>    
                    <%=uiListDataTD%>><%=BUS_CATEGORY_CODE[j] %></td>
                    <%=uiListDataTD%>><%=StringUtil.showPrice(Double.parseDouble(moneys[0]),2) %></td>
                    <%=uiListDataTD%>><%=StringUtil.showPrice(Double.parseDouble(moneys[1]),2) %></td>    
                    <%=uiListDataTD%>><%=StringUtil.showPrice(Double.parseDouble(moneys[2]),2) %></td>
                    <%=uiListDataTD%>><%=StringUtil.showPrice(Double.parseDouble(moneys[3]),2) %></td>   
                    <%=uiListDataTD%>><%=StringUtil.showPrice(Double.parseDouble(moneys[4]),2) %></td>    
                    <%=uiListDataTD%>><%=StringUtil.showPrice(Double.parseDouble(moneys[6]),2)+"("+StringUtil.showPrice(Double.parseDouble(moneys[7]),2)+"%)" %></td>
                    <%=uiListDataTD%>><%=StringUtil.showPrice(Double.parseDouble(moneys[8]),2)+"("+StringUtil.showPrice(Double.parseDouble(moneys[9]),2)+"%)" %></td>     
                </tr>
            <%}%>
            <%} %>
            <%}else{  %>
          <%=uiListDataTR[0]%> align=center>  
            <%=uiListDataTD%> colspan = "9">查无记录</td>    
               
            </tr> 
        <%} %>
            <%}%>

<%=uiListEnd%>
</form>
<%@ include file="/framework/foot.jsp"%>

<!--
    Author    :Benny
    FileName  :/system/base/BusMaterialAccountKilList.jsp
-->
